﻿@using HiLand.Utility4.MVC.Controls
@using HiLand.Framework.BusinessCore
@using GBFinance.Web.Models
@using GBFinance.Web.Control
@using HiLand.General.Entity
@using HiLand.General
@model EnterpriseEntity
@{
    Layout = null;
    MvcControlUsingModes usingMode = (this.ViewContext.Controller as GBFinance.Web.Controllers.BaseLoanController).GetUsingMode();
    bool isPopLayer = (this.ViewContext.Controller as GBFinance.Web.Controllers.BaseLoanController).CheckIsPopLayer();
    EnterpriseEntity enterpriseRef1 = this.ViewBag.EnterpriseRef1;
    EnterpriseEntity enterpriseRef2 = this.ViewBag.EnterpriseRef2;
}
<div id="UAboutYourBusinessContainer">
    @using (Html.BeginForm())
    { 
        <fieldset id="businessDetails" class="simpleFieldset">
            <legend>Business Details</legend>
            <table>
                <tr>
                    <td>
                        @Html.GBFEnterpriseTypeDropDownList().Value((Model.BusinessType).ToString()).Name("BusinessType").Lable("Business Type").UsingMode(usingMode).Render()
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td>
                        @Html.HiTextBox().Name("CompanyName").Value(Model.CompanyName).Lable("Company Name").UsingMode(usingMode).Render()
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td>
                        @Html.HiTextBox().Name("TradingName").Value(Model.TradingName).Lable("Trading Name").UsingMode(usingMode).Render()
                    </td>
                    <td>
                        @Html.HiTextBox().Name("EnterpriseCode").Value(Model.EnterpriseCode).Lable("ACN/ABN").UsingMode(usingMode).Render()
                    </td>
                </tr>
                <tr>
                    <td>@Html.HiTextBox().Name("PrincipleAddress").Value(Model.PrincipleAddress).Lable("Principle Address").UsingMode(usingMode).Render()
                    </td>
                    <td>
                        @Html.HiTextBox().Name("PostCode").Value(Model.PostCode).Lable("Post Code").UsingMode(usingMode).Render()
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.HiTextBox().Name("Telephone").Value(Model.Telephone).Lable("Telephone").UsingMode(usingMode).Render()
                    </td>
                    <td>
                        @Html.HiTextBox().Name("Fax").Value(Model.Fax).Lable("Fax").UsingMode(usingMode).Render()
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.HiTextBox().Name("Industry").Value(Model.Industry).Lable("Industry").UsingMode(usingMode).Render()
                    </td>
                    <td>
                        @Html.HiTextBox().Name("EstablishedYears").Value(Model.EstablishedYears.ToString()).Lable("Established Years").UsingMode(usingMode).Render()
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.HiTextBox().Name("GrossIncome").Value(Model.GrossIncome.ToString()).Lable("Gross Income Last Fin. Year").UsingMode(usingMode).Render()
                    </td>
                    <td>
                        @Html.HiTextBox().Name("Profit").Value(Model.Profit.ToString()).Lable("Profit").UsingMode(usingMode).Render()
                    </td>
                </tr>
            </table>
            @Html.HiddenFor(m => m.EnterpriseID)
            @Html.HiddenFor(m => m.EnterpriseGuid)
        </fieldset>
        
        <fieldset id="referencesDetails" class="simpleFieldset">
            <legend>References Details</legend>
            <table>
                <tr>
                    <td>@Html.HiTextBox().Name("CompanyNameRef1").Value(enterpriseRef1.CompanyName).Lable("Company Name").UsingMode(usingMode).Render()
                    </td>
                    <td>@Html.HiTextBox().Name("ContactNameRef1").Value(enterpriseRef1.ContactPerson).Lable("Contact Name").UsingMode(usingMode).Render()
                    </td>
                </tr>
                <tr>
                    <td>@Html.HiTextBox().Name("TelephoneRef1").Value(enterpriseRef1.Telephone).Lable("Telephone").UsingMode(usingMode).Render()
                    </td>
                    <td></td>
                </tr>
            </table>
            <hr style="border-top:1px dashed" />
            <table>
                <tr>
                    <td>@Html.HiTextBox().Name("CompanyNameRef2").Value(enterpriseRef2.CompanyName).Lable("Company Name").UsingMode(usingMode).Render()
                    </td>
                    <td>@Html.HiTextBox().Name("ContactNameRef2").Value(enterpriseRef2.ContactPerson).Lable("Contact Name").UsingMode(usingMode).Render()
                    </td>
                </tr>
                <tr>
                    <td>@Html.HiTextBox().Name("TelephoneRef2").Value(enterpriseRef2.Telephone).Lable("Telephone").UsingMode(usingMode).Render()
                    </td>
                    <td></td>
                </tr>
            </table>
            @Html.Hidden("EnterpriseGuidRef1", enterpriseRef1.EnterpriseGuid)
            @Html.Hidden("EnterpriseGuidRef2", enterpriseRef2.EnterpriseGuid)
        </fieldset>
    }
    @if (isPopLayer == true)
    {
        <div class="notification attention png_bg">
            <a href="#" class="close">
                <img src="@Url.Content("~/Content/NotificationImages/cross_grey_small.png")" title="Close this notification"
            alt="close" /></a>
            <div class="notificationContent">
                You can close this PopWindow by the key "Esc".
            </div>
        </div>
        <input type="button" value="Save" id="btnSave" />
        <script type="text/javascript">
            $(document).ready(function () {
                $("#UAboutYourBusinessContainer #btnSave").click(function () {
                    $("#UAboutYourBusinessContainer form").ajaxSubmit({
                        success: function (responseInfo) {
                            if (responseInfo.IsSuccessful == false) {
                                alert(responseInfo.statusMessage);
                            }
                            else {
                                //alert(responseInfo.IsSuccessful);
                                window.location.reload();
                            }
                        },
                        data: { "isAjaxDeal": "true" }
                    });
                });
            });
        </script>
    }
</div>
